﻿<%@ Page Language="C#" %>

<%@ Import Namespace="wojilu" %>
<%@ Import Namespace="wojilu.View" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Domain" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>#{softtitle}</title>
<link href="#{path.css}ybb/css/baselist.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/all.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/formdiv.css?v=#{cssVersion}" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="#{path.js}ybb/js/jquery.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/control.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/form.js?v=#{jsVersion}"></script>
<script type="text/javascript" charset="utf-8">window.UEDITOR_HOME_URL = "#{path.static}public/ueditor/"</script>
<script type="text/javascript" src="#{path.static}public/ueditor/ueditor.config.js?v=#{jsVersion}" charset="utf-8"></script>
<script type="text/javascript" src="#{path.static}public/ueditor/ueditor.all.min.js?v=#{jsVersion}" charset="utf-8"></script>
<script type="text/javascript" src="#{path.static}public/ueditor/lang/zh-cn/zh-cn.js?v=#{jsVersion}" charset="utf-8"></script>
<script type="text/javascript">

	var resizewindow= null;

	window.onresize = function(){
		var h = $(window).height();
		if(resizewindow!=h){
			sizewindow();
			resizewindow=h;
		}
	}

	function sizewindow(){
		var h = $(window).height();
		var w = $(window).width();
		if(document.getElementById("mainbodybottonauto")){
			$('.managebottonadd').css({height:h-40});
		}
		$('.maneditcontent_editor').css({ width: w-170});
	}
	var setting_js_save_ok = "_{setting_js_save_ok}";
	var setting_js_save_no = "_{setting_js_save_no}";
	var iframename = "#{IframeName}";
	$(document).ready(function () {
	    var h = '#{IframeHeightWindow}';
	    var w = '#{IframeWidthWindow}';
		$('.managebottonadd').css({height:h-40});
		$('.maneditcontent_editor').css({ width: w-170});
		var options = {

			beforeSubmit: formverify,

			success:saveResponse,
			resetForm: false
		}
		$('#setting').submit(function () {
		    <%for(Int32 key = 1; key < 100; key++){ %>
		      <%var list = Configs.find("groupid=:g order by pid asc,id asc").set("g", key).list(); %>
		      <%foreach(var row in list){ %>
                <%if (row.valtype == "editor") { %>
		          $("#<%=row.valname %>").val(UE.getEditor('<%=row.valname %>editor').getContent());
		        <%}%>
		      <%}%>
            <%}%>
			$(this).ajaxSubmit(options);
			return false;
		});
	})

	function formverify(formData) {
	    parent.windowsdig('Loading', 'iframe:#{load}', '400px', '180px', 'iframe', false);
	}
	function saveResponse(options){
		parent.closeifram();
		if (options=='true'){
			alert(setting_js_save_ok);
		}else{
			alert(setting_js_save_no);
		}
	}
</script>
</head>

<body>
<form name="setting" id="setting" method="post" action="#{ActionLink}">
<div id="mainbodybottonauto" class="managebottonadd">
	<div class="maindobycontent">
		<!--查看已选择的类型-->
		<div class="suggestion">
			<span class="sugicon"><span class="strong colorgorning2">_{position_title}</span><span class="colorgorningage">_{setting_edit_mess}</span></span>
		</div>
        <%var groupid = Convert.ToInt32(v.data("groupid")); %>
		<div class="lefteditor">
			<ul>
				<li <%if(groupid ==1){ %> class="hover" <%} %>id="tabbottonul1"  onmousedown="javascript:windowsclass('#tabbottonul1','#tabcontentdiv1','tabbottonul','tabcontentdiv',1,100,'hover','');">_{setting_edit_title1}</li>
				<li <%if(groupid ==2){ %> class="hover" <%} %>id="tabbottonul2"  onmousedown="javascript:windowsclass('#tabbottonul2','#tabcontentdiv2','tabbottonul','tabcontentdiv',2,100,'hover','');">_{setting_edit_title2}</li>
				<li <%if(groupid ==3){ %> class="hover" <%} %>id="tabbottonul3"  onmousedown="javascript:windowsclass('#tabbottonul3','#tabcontentdiv3','tabbottonul','tabcontentdiv',3,100,'hover','');">_{setting_edit_title3}</li>
				<li <%if(groupid ==4){ %> class="hover" <%} %>id="tabbottonul4"  onmousedown="javascript:windowsclass('#tabbottonul4','#tabcontentdiv4','tabbottonul','tabcontentdiv',4,100,'hover','');">_{setting_edit_title4}</li>
				<li <%if(groupid ==5){ %> class="hover" <%} %>id="tabbottonul5"  onmousedown="javascript:windowsclass('#tabbottonul5','#tabcontentdiv5','tabbottonul','tabcontentdiv',5,100,'hover','');">_{setting_edit_title5}</li>
				<li <%if(groupid ==6){ %> class="hover" <%} %>id="tabbottonul6"  onmousedown="javascript:windowsclass('#tabbottonul6','#tabcontentdiv6','tabbottonul','tabcontentdiv',6,100,'hover','');">_{setting_edit_title6}</li>
                <li <%if(groupid ==99){ %> class="hover" <%} %>id="tabbottonul99"  onmousedown="javascript:windowsclass('#tabbottonul99','#tabcontentdiv99','tabbottonul','tabcontentdiv',99,100,'hover','');">_{setting_edit_title9}</li>
			</ul>
		</div>
		<div class="manageeditdiv">
			<div class="maneditcontent_editor">
            <%for(Int32 key = 1; key < 100; key++){ %>
			<table class="formtable <%if(key != groupid){ %>displaynone<%} %>" id="tabcontentdiv<%=key %>">
                <%var list = Configs.find("groupid=:g order by pid asc,id asc").set("g", key).list(); %>
                <%foreach(var row in list){ %>
                <%if(row.isline==1){ %>
				<tr class="trstyle2">
					<td class="trtitle03" colspan="2"><%=row.str %></td>
				</tr>
                    <%if (row.valname == "title_mail") { %>
					<tr class="trstyle2">
						<td class="trtitle01"></td>
						<td class="trtitle02"><a class="infolink05" onclick="javascript:submiturl('MaildeMo.aspx?','#{load}','_{run_ok}','_{run_no}',false,'','selectform','selectall','check_all')" href="#body" title="_{mailtemplatemain_send_demo}" hidefocus="true">_{mailtemplatemain_send_demo}</a> <span class="cautiontitle">_{mailtemplatemain_send_demo_mess}</span></td>
					</tr>
					<%} %>
				<%} else { %>
				<tr class="trstyle2">
					<td class="trtitle01"><%=row.content %></td>
					<td class="trtitle02">
                        <%if (row.valtype == "string") { %>
						<input type="text" name="<%=row.valname %>" size="50" maxlength="250" value="<%=row.value %>" class="infoInput"/>
						<%} %>
                        <%if (row.valtype == "password")
                          { %>
						<input type="password" name="<%=row.valname %>" size="50" maxlength="250" value="<%=row.value %>" class="infoInput"/>
						<%} %>
                        <%if (row.valtype == "text")
                          { %>
						<textarea name="<%=row.valname %>" cols="50" rows="5" class="smallInput" style="width:98%;height:50px;"><%=row.value %></textarea>
						<%} %>
                        <%if (row.valtype == "editor")
                          { %>
                        <script type="text/plain" id="<%=row.valname %>editor" name="<%=row.valname %>editor" style="width:100%;height:500px;"><%=row.value %></script><input id="<%=row.valname %>" name="<%=row.valname %>" type="hidden" />
                        <script type="text/javascript">
                            UE.getEditor('<%=row.valname %>editor', {
                                toolbars: [['fullscreen', 'source', '|', 'bold', 'italic', 'underline', 'fontborder', '|', 'forecolor', 'backcolor', '|', 'customstyle', 'paragraph', 'fontfamily', 'fontsize', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'link', 'unlink', '|']],
                                autoClearinitialContent: false,
                                wordCount: false,
                                elementPathEnabled: false,
                                initialFrameHeight: 100,
                                initialFrameWidth: '98%',
                                initialContent: '',
                                initialStyle: 'p{line-height:1em; font-size: 12px; }'
                            });
                        </script>
                        <%} %>
                        <%if (row.valtype == "font")
                          { %>
						<input type="text" name="<%=row.valname %>" size="30" maxlength="250" value="<%=row.value %>" class="infoInput"/>
						<%} %>
                        <%if (row.valtype == "int")
                          { %>
						<input type="text" name="<%=row.valname %>" size="10" maxlength="20" value="<%=row.value %>" class="infoInput"/>
						<%} %>
                        <%if (row.valtype == "bool")
                          { %>
                        <%var strArray = strUtil.Split(row.bottonname, ","); %>
						<input type="radio" value="1" name="<%=row.valname %>"<%if(row.value=="1"){ %> checked="checked"<%} %>/> <%=strArray[0] %>&nbsp;
						       <input type="radio" value="0" name="<%=row.valname %>"<%if(row.value=="0"){ %> checked="checked"<%} %>/> <%=strArray[1] %>
						<%} %>
                        <%if (row.valtype == "select")
                          { %>
							<select size="1" name="<%=row.valname %>" id="<%=row.valname %>">
                            <%foreach (var row1 in Lng.find("isopen=:i order by pid asc,id asc").set("i", 1).list())
                              { %>
								<option <%if(row.value == row1.lng){ %> selected<%} %> value="<%=row1.lng %>"><%=row1.lngtitle %></option>
							<%} %>
							</select>
						<%} %>
                        <%if (row.valtype == "selectkey")
                          { %>
                        <%var strArray = strUtil.Split(row.bottonname, ","); %>
							<select size="1" name="<%=row.valname %>" id="<%=row.valname %>">
                            <%foreach(var str in strArray){ %>
                                <%var strArray1 = strUtil.Split(str, "|"); %>
								<option <%if(row.value==strArray1[0]){ %>selected<%} %> value="<%=strArray1[0] %>"><%=strArray1[1] %></option>
							<%} %>
							</select>
						<%} %>
						<%if (!row.str.StrIsNullOrEmpty() && row.valtype != "text") { %><span class="cautiontitle"><%=row.str %></span><%} %>
						
					</td>
				</tr>
                    <%if (!row.str.StrIsNullOrEmpty() && row.valtype == "text") { %>
					<tr class="trstyle2">
						<td></td>
						<td class="trtitle02"><span class="cautiontitle"><%=row.str %></span></td>
					</tr>
					<%} %>
                <%} %>
				<%} %>
				<tr>
					<td colspan="2"></td>
				</tr>
			</table>
            <%} %>
			</div>
		</div>
	</div>
</div>
<div id="downbotton">
	<div id="subbotton">
		<table border="0" width="100%">
			<tr>
				<td id="center"><input type="submit" name="Submit" value="_{botton_edit}" class="buttonface" /></td>
			</tr>
		</table>
	</div>
</div>
</form>
</body>

</html>